package com.ssit.answer.dto.${packageDir};

import java.util.List;

import com.ssit.answer.domain.${packageDir}.${className};
import com.ssit.answer.base.root.page.Page;
import com.ssit.answer.base.utils.bean.BeanUtil;

/**
 * 描述:<br/>
 * 字典明细表 ${className} 传输对象
 *
 * @author shisongbin@ssit-xm.com.cn 2018年09月09日
 */
public class ${className}Dto extends ${className} implements Cloneable {

	/** serialVersionUID **/
	private static final long serialVersionUID = 1L;
	
	/** 自定义扩展字段 **/
	
	@Override
	public Object clone() {
		try {
			return super.clone();
		} catch (CloneNotSupportedException e) {
			e.printStackTrace();
		}
		return null;
	}
	
	/**转成数据库对象**/
	public ${className} to${className}() {
		return (${className}) clone();
	}

	/** 转成DTO传输对象,可自定义扩展 **/
	public static ${className}Dto to${className}Dto(${className} ${className?uncap_first}) {
		return (${className}Dto) BeanUtil.copy(${className?uncap_first}, ${className}Dto.class);
	}
	
	/** 转成List<DTO>传输对象,可自定义扩展 **/
	public static List<${className}Dto> toList${className}Dto(List<${className}> list${className}) {
		return (List<${className}Dto>) BeanUtil.copy(list${className}, ${className}Dto.class);
	}
	
	/** 转成Page<DTO>传输对象,可自定义扩展 **/
	public static Page toPage${className}Dto(Page page) {
		if(page == null){
			return null;
		}
		page.setItems(toList${className}Dto(page.getItems()));
		return page;
	}
}